﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebDemo.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>自动刷新测试</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <%--注册时钟，设置周期，默认不启动--%>
        <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="3000" Enabled="false">
        </asp:Timer>
        <div>
            <asp:Label ID="Label1" runat="server" Text="更新周期(s)"></asp:Label>
            <asp:TextBox ID="txtTimerInterval" runat="server" Text="3"></asp:TextBox>            
        </div>
        <div>
            <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <%--注册执行任务按钮--%>
                    <asp:Button ID="btnReload" runat="server" Text="自动刷新" OnClick="btnReload_Click" />
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        <div>
            <asp:Label ID="Label2" runat="server" Text="线别"></asp:Label>
            <asp:TextBox ID="txtGroup" runat="server"></asp:TextBox>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                </Triggers>
                <ContentTemplate>
                    <asp:Label ID="lblTime" runat="server" Text="更新时间："></asp:Label>
                    <asp:Label ID="txtTime" runat="server" Text="" ForeColor="Red"></asp:Label><br />
                    <br />
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
                        <Columns>
                            <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" />
                            <asp:BoundField DataField="Group" HeaderText="Group" />
                            <asp:BoundField DataField="Wo" HeaderText="Wo" ReadOnly="True" />
                            <asp:BoundField DataField="Qty" HeaderText="Qty" ReadOnly="True" />
                        </Columns>
                    </asp:GridView>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </form>
</body>
</html>
